#ifndef CPU_EXECUTEOPCODE_H
#define CPU_EXECUTEOPCODE_H

#include "data.h"
#include "opcodes.h"
#include "macros.h"
#include "SYS_Timer.h"
#include <stdio.h>

void CPU_ExecuteOpcode(struct Agent_Var* agent)
{
    if(agent->countdown > 0)
    {
        if(agent->last > SYS_GetCurrentTimeMs())
        {
            //printf("%d\n",agent->last-SYS_GetCurrentTimeMs());
            return;
        }
        else
        {
            //printf("%d\n",SYS_GetDelta(agent->last) );
            agent->countdown = 0;
        }


    }
    opcode_t opcode = READ_CODE(agent,opcode_t);
    tavm_run_opcode[opcode](agent);
}

#endif

